onselect Property |
This is an optional property that contains the pointer to a function to be to be called when an item in the tree is selected.
Syntax
XML |
<TreeItem>
<searchPath>sName</searchPath>
<description>sDesc</description>
<onselect>fpFunction</description>
..
..
..
</TreeItem>
|
Parameters
Parameter |
Description |
|---|---|
fpFunction |
Pointer to a function that is to be called when an item in the tree is selected. |
Remarks
The parameter passed to the onselect function will contain the item that is selected.
Example
The following example shows how the property is used.
<!-- Schema for tree. "selectHandler" is a function that will be called when item is selected -->
<script type="cordys/xml" id="schema">
<TreeSchema>
<searchPath>//data/tuple/old/</searchPath>
<Root>
<description>Employees</description>
</Root>
<TreeItem id="EmployeesID">
<searchPath>Employees</searchPath>
<description>FirstName</description>
<onselect>selectHandler</onselect>
</TreeItem>
</TreeSchema>
</script>
//Function call
function selectHandler(selectedNode)
{
<!-- Alert data of the selected item -->
application.notify("item selected : " + selectedNode.data.xml);
}
<!-- tree definition -->
<div cordysType="wcp.libaray.ui.Tree" id="sampleTree" treeSchema="schema" treeData="data">
</div>